﻿using System;
using System.Collections;
using System.Web;

namespace ZHONGLANGWORD.WebOffice
{
    public partial class TEST : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pageInit();
            }
        }
        protected void pageInit()
        {
            string strHost = HttpContext.Current.Request.Url.Host.ToString();
            string strPart = HttpContext.Current.Request.Url.Port.ToString();
            hidCurrHttpUrl.Text = "HTTP://" + strHost + (strPart == "80" ? "" : ":"+ strPart); 
            
            hidCurrTempFile.Text = "/WEBOFFICE/TEMP/TEST/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";

            System.IO.File.Copy(MapPath("TEST.doc"), MapPath(hidCurrTempFile.Text));
        }

        protected void btnReload_Click(object sender, EventArgs e)
        {
            pageInit();

            SortedList SDList = new SortedList();
            SDList[txtMarkName.Text] = txtMarkValue.Text;
            string strFileLocPath = MapPath(hidCurrTempFile.Text);
            PUBWORD.proMarkWord(SDList, strFileLocPath);
        }

         


        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strFileLocPath = MapPath(hidCurrTempFile.Text);
            string strFileMarkPath = MapPath("/WEBOFFICE/TEMP/MARK/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
            if (chkMark.Checked) { PUBWORD.proMarkTest(strFileLocPath,"当前用户", strFileMarkPath); }

            System.IO.File.Copy(MapPath(hidCurrTempFile.Text), MapPath("TESTOK.doc"));
            hrlCheck.Visible = true;
        }
    }
}